package com.test.controller;

import com.alibaba.fastjson.JSON;
import com.test.pojo.Books;
import com.test.service.BookServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("v1")
public class BookController {
    @Autowired
    private BookServiceImpl bookService;

    @GetMapping("list")
    public String list() {
        List<Books> books = bookService.queryAllBook();
        return JSON.toJSONString(books);
    }
}
